package com.dotflat.fin.domain;

import com.dotflat.refund.domain.RefundRecordItem;
import com.dotflat.rest.domain.AreableObjectBase;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * 退费记录
 */

@Data
@Entity
@Table(name="fin_refund_record")
@EqualsAndHashCode(callSuper = true)
public class RefundRecord extends AreableObjectBase  {

    @Column(columnDefinition = "VARCHAR(32) COMMENT '总部审核人员姓名'")
    @ApiModelProperty("总部审核人员姓名")
    private String auditName;

    @Column(columnDefinition = "VARCHAR(32) COMMENT '总部审核单据号'")
    @ApiModelProperty("总部审核单据号")
    private String auditFlowNO;

    @Column(columnDefinition = "VARCHAR(32) COMMENT '宝宝名称'")
    @ApiModelProperty("宝宝名称")
    private String childName;

    @Column(columnDefinition = "VARCHAR(32) COMMENT '客户id'", nullable = false)
    @ApiModelProperty("客户id")
    private String clienteleId;

    @Column(columnDefinition = "bit(1) DEFAULT 0 COMMENT '是否已经退费 0.未退费  1.退费成功' ", nullable = false)
    @ApiModelProperty("是否已经退费")
    public Boolean refunded = false;

    @Column(columnDefinition = "INT default 0 COMMENT '退款支付总金额'")
    @ApiModelProperty("退款支付总金额")
    private Long refundMoney = 0L;

    @Column(columnDefinition = "VARCHAR(32) COMMENT '退款支付时间'")
    @ApiModelProperty("退款支付时间")
    private Date refundTime;

    @Column(columnDefinition = "varchar(32) COMMENT '退款支付账号'")
    @ApiModelProperty("退款支付账号")
    private String refundAccountId;

    @Column(columnDefinition = "VARCHAR(16) COMMENT '退款支付方式'")
    @ApiModelProperty("退款支付方式")
    private String refundType;

    @Column(columnDefinition = "varchar(64) COMMENT '退款支付账号银行流水号'")
    @ApiModelProperty("退款支付账号银行流水号")
    private String serialNumber;

    @Column(columnDefinition = "varchar(256) COMMENT '退款备注'")
    @ApiModelProperty("退款备注")
    private String remark;

    @Transient
    private String className;

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "record")
    @OrderBy("created")
    private List<RefundRecordItem> items;

}